﻿using System;
using System.IO;
using Character;
using UnityEngine;

// Token: 0x02000188 RID: 392
[Serializable]
public class AccessoryCustom : ParameterBase
{
	// Token: 0x06000A1A RID: 2586 RVA: 0x0003B8B4 File Offset: 0x00039AB4
	public AccessoryCustom(SEX sex) : base(sex)
	{
		this.Init();
	}

	// Token: 0x06000A1B RID: 2587 RVA: 0x0003B904 File Offset: 0x00039B04
	public AccessoryCustom(AccessoryCustom copy) : base(copy.sex)
	{
		this.Copy(copy);
	}

	// Token: 0x06000A1C RID: 2588 RVA: 0x0003B95C File Offset: 0x00039B5C
	public void Init()
	{
		this.type = ACCESSORY_TYPE.NONE;
		this.id = -1;
		this.nowAttach = ACCESSORY_ATTACH.NONE;
		this.addPos = Vector3.zero;
		this.addRot = Vector3.zero;
		this.addScl = Vector3.one;
		this.color = null;
	}

	// Token: 0x06000A1D RID: 2589 RVA: 0x0003B99C File Offset: 0x00039B9C
	public void Copy(AccessoryCustom src)
	{
		this.type = src.type;
		this.id = src.id;
		this.nowAttach = src.nowAttach;
		this.addPos = src.addPos;
		this.addRot = src.addRot;
		this.addScl = src.addScl;
		if (src.color != null)
		{
			this.color = new ColorParameter_PBR2(src.color);
		}
		else
		{
			this.color = null;
		}
	}

	// Token: 0x06000A1E RID: 2590 RVA: 0x0003BA1C File Offset: 0x00039C1C
	public void Set(ACCESSORY_TYPE type, int id, string key)
	{
		this.type = type;
		this.id = id;
		this.nowAttach = AccessoryData.CheckAttach(key);
		this.color = new ColorParameter_PBR2();
		if (this.nowAttach == ACCESSORY_ATTACH.NONE && type != ACCESSORY_TYPE.NONE)
		{
			AccessoryData acceData = CustomDataManager.GetAcceData(type, id);
			if (acceData != null)
			{
				this.nowAttach = acceData.defAttach;
			}
		}
	}

	// Token: 0x06000A1F RID: 2591 RVA: 0x0003BA7C File Offset: 0x00039C7C
	public void ResetAttachPosition()
	{
		this.addPos = Vector3.zero;
		this.addRot = Vector3.zero;
		this.addScl = Vector3.one;
	}

	// Token: 0x06000A20 RID: 2592 RVA: 0x0003BAA0 File Offset: 0x00039CA0
	public bool CheckAttachInHead()
	{
		return AccessoryData.CheckAttachInHead(this.nowAttach);
	}

	// Token: 0x06000A21 RID: 2593 RVA: 0x0003BAB0 File Offset: 0x00039CB0
	public void CheckHasData()
	{
		if (!CustomDataManager.HasAcceData(this.type, this.id))
		{
			this.Init();
		}
	}

	// Token: 0x06000A22 RID: 2594 RVA: 0x0003BAD0 File Offset: 0x00039CD0
	public void Save(BinaryWriter writer, SEX sex)
	{
		this.Write(writer, this.type);
		base.Write(writer, this.id);
		this.Write(writer, this.nowAttach);
		base.Write(writer, this.addPos);
		base.Write(writer, this.addRot);
		base.Write(writer, this.addScl);
		if (this.color != null)
		{
			this.color.Save(writer);
		}
		else
		{
			writer.Write(0);
		}
	}

	// Token: 0x06000A23 RID: 2595 RVA: 0x0003BB50 File Offset: 0x00039D50
	public void Load(BinaryReader reader, SEX sex, CUSTOM_DATA_VERSION version)
	{
		this.Read(reader, ref this.type);
		base.Read(reader, ref this.id);
		this.Read(reader, ref this.nowAttach);
		base.Read(reader, ref this.addPos);
		base.Read(reader, ref this.addRot);
		base.Read(reader, ref this.addScl);
		this.color = new ColorParameter_PBR2();
		this.color.Load(reader, version);
	}

	// Token: 0x06000A24 RID: 2596 RVA: 0x0003BBC4 File Offset: 0x00039DC4
	protected void Write(BinaryWriter writer, ACCESSORY_TYPE val)
	{
		writer.Write((int)val);
	}

	// Token: 0x06000A25 RID: 2597 RVA: 0x0003BBD0 File Offset: 0x00039DD0
	protected void Read(BinaryReader reader, ref ACCESSORY_TYPE val)
	{
		val = (ACCESSORY_TYPE)reader.ReadInt32();
	}

	// Token: 0x06000A26 RID: 2598 RVA: 0x0003BBDC File Offset: 0x00039DDC
	protected void Write(BinaryWriter writer, ACCESSORY_ATTACH val)
	{
		writer.Write((int)val);
	}

	// Token: 0x06000A27 RID: 2599 RVA: 0x0003BBE8 File Offset: 0x00039DE8
	protected void Read(BinaryReader reader, ref ACCESSORY_ATTACH val)
	{
		val = (ACCESSORY_ATTACH)reader.ReadInt32();
	}

	// Token: 0x04000A35 RID: 2613
	public const int SLOT_NUM = 10;

	// Token: 0x04000A36 RID: 2614
	public ACCESSORY_TYPE type = ACCESSORY_TYPE.NONE;

	// Token: 0x04000A37 RID: 2615
	public int id = -1;

	// Token: 0x04000A38 RID: 2616
	public ACCESSORY_ATTACH nowAttach = ACCESSORY_ATTACH.NONE;

	// Token: 0x04000A39 RID: 2617
	public Vector3 addPos = Vector3.zero;

	// Token: 0x04000A3A RID: 2618
	public Vector3 addRot = Vector3.zero;

	// Token: 0x04000A3B RID: 2619
	public Vector3 addScl = Vector3.one;

	// Token: 0x04000A3C RID: 2620
	public ColorParameter_PBR2 color;
}
